package com.request; /**
 * @author wzm
 * @create 2023-04-25 15:38
 */

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//此Servlet测试转发
@WebServlet("/request03")
public class Request03 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      //调用doPost处理
        doPost(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
       //获取请求的参数（吃米线的钱）
        String money = request.getParameter("money");
        System.out.println("在窗口A(Request03)查看参数（钱）" + money);

        //给小票 并且小票传递到窗口B(Request04)查看
        request.setAttribute("xiaopiao","大碗米线15元");//域对象

        //问路 去哪里抬米线 怎么走
        RequestDispatcher path = request.getRequestDispatcher("/request04");//窗口B

        //走向窗口B(/request04)
        path.forward(request,response);



    }
}
